<?php

namespace plugin\admin\app\model;

use plugin\admin\app\model\Base;

/**
 * @property integer $id (主键)
 * @property integer $role 角色，1客服，2用户
 * @property integer $user_id 用户ID
 * @property integer $message_type 消息类型，1文本消息, 2图片消息
 * @property string $content 消息内容
 * @property string $created_time 创建时间
 */
class Message extends Base
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'wa_messages';

    /**
     * The primary key associated with the table.
     *
     * @var string
     */
    protected $primaryKey = 'id';
    /**
     * Indicates if the model should be timestamped.
     *
     * @var bool
     */
    public $timestamps = false;

    const TEXT_MESSAGE = 1;

    const IMAGE_MESSAGE = 2;

    const ROLE_SYSTEM = 1;

    const ROLE_USER = 2;

    public static function getMessageTypeText($messageType)
    {
        switch ($messageType) {
            case self::TEXT_MESSAGE:
                return '文本消息';
            case self::IMAGE_MESSAGE:
                return '图片消息';
        }
    }
    
}
